package com.lixinyue.array;

import java.util.Arrays;

//
public class demo08 {
    public static void main(String[] args) {
//     1.判断数组是否相等    boolean equals(int[]arr1,int[]arr2);
        int[] arr1=new int[]{1,2,3,4};
        int [] arr2=new int[]{9,2,6,4};
        boolean isEquals=Arrays.equals(arr1,arr2);
        System.out.println(isEquals);
//    2.输出数组信息  String toString(int[] a);
        System.out.println(Arrays.toString(arr1));
//    3.将指定值填充到数组之中 void fill(int[] a,int val);
        Arrays.fill(arr1,9);
        System.out.println(Arrays.toString(arr1));
//        4.对数组排序void sort (int[]a);
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
//        5.二分查找 int binarySearch(int[]a,int key)；
        int[] arr3=new int[]{111,23,45,88,1,0,90,7,-100,222};
        int index=Arrays.binarySearch(arr3,7);
        System.out.println(index);
    }
}
